package com.mvc.controller;

import com.mvc.service.HelloService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath*:*.xml"})
@Controller
public class HelloController {

    @Autowired
    HelloService helloService;

    @Test
    public void test(){

        System.out.println("123456");
        helloService.showHello();
    }


    @RequestMapping("/index")
    public String HelloSpring(){
        int i=1;
        int j=2;

        helloService.showHello();
        return "index";
    }


    @RequestMapping("/hello")
    @ResponseBody
    public String Hello(){

        return "hello hi";
    }

    @RequestMapping("/main")
    public String app(){

        return "main";
    }
}
